#! /usr/bin/env  node

let program = require('commander');
const { version } = require('./package.json');
let inquirer = require('inquirer')
    // let options = program.opts();
    // console.log(options)
let arr = [{
    name: 'type',
    type: 'list',
    message: '请选择',
    choices: [1, 2, 3]
}, {
    name: 'user',
    type: 'input',
    message: '用户名',
}]
program
    .version(version)
    .option('-a --add <file.name>', 'add file')
    .command('revert <name>')
    .action(function(dirs, cmd, opt) {
        console.log(dirs);
        console.log(cmd);
        console.log(opt)

    })
    .parse(process.argv)


const options = program.opts();
console.log(options.add)
if (options.add) {
    inquirer.prompt(arr).then(res => {
        console.log(res)
    })
    console.log('添加一个文件')
}
if (options.del) console.log('删除一个文件')